#include <ros/ros.h>
#include <learning_topic/Person.h>

int main(int arg, char **args)
{
    ros::init(arg, args, "person_publisher");
    
    ros::NodeHandle node;

    ros::Publisher person_info_pub = node.advertise<learning_topic::Person>("/person_info", 10);

    ros::Rate loop_rate(10);

    int count = 0;
    while (ros::ok())
    {
        learning_topic::Person person_msg;
        person_msg.name = "Tom";
        person_msg.sex = learning_topic::Person::male;
        person_msg.age = 18;

        person_info_pub.publish(person_msg);

        ROS_INFO("Publish person info: name:%s sex:%d age:%d", person_msg.name.c_str(), person_msg.sex, person_msg.age);

        loop_rate.sleep();
    }
    
    return 0;
}